package com.guigu.pd.auth.controller;

import java.util.Arrays;
import java.util.Map;


import com.guigu.pd.auth.dao.AuthRoleDao;
import com.guigu.pd.auth.entity.CoreStationEntity;
import com.guigu.pd.auth.entity.PageVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.guigu.pd.auth.entity.AuthRoleEntity;
import com.guigu.pd.auth.service.AuthRoleService;
import com.guigu.common.utils.PageUtils;
import com.guigu.common.utils.R;



/**
 * 
 *
 * @author deyran
 * @email deyran@gmail.com
 * @date 2022-07-19 19:05:57
 */
@RestController
@RequestMapping("auth/authrole")
public class AuthRoleController {
    @Autowired
    private AuthRoleService authRoleService;

    /**
     * 列表
     */
//    @RequestMapping("/list")
//    //@RequiresPermissions("auth:authrole:list")
//    public R list(@RequestParam Map<String, Object> params){
//        PageUtils page = authRoleService.queryPage(params);
//
//        return R.ok().put("page", page);
//    }
    @PostMapping(value = "authRoleEntity.action/{pagecurrent}/{pagesize}")
    public PageVo<AuthRoleEntity> coreStationEntitylist(@RequestBody AuthRoleEntity authRoleEntity, @PathVariable int pagecurrent, @PathVariable int pagesize){

        PageVo<AuthRoleEntity> queryrole = authRoleService.queryRoleEntity(authRoleEntity, pagecurrent, pagesize);
        return queryrole;
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("auth:authrole:info")
    public R info(@PathVariable("id") Long id){
		AuthRoleEntity authRole = authRoleService.getById(id);

        return R.ok().put("authRole", authRole);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("auth:authrole:save")
    public R save(@RequestBody AuthRoleEntity authRole){
		authRoleService.save(authRole);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("auth:authrole:update")
    public R update(@RequestBody AuthRoleEntity authRole){
		authRoleService.updateById(authRole);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("auth:authrole:delete")
    public R delete(@RequestBody Long[] ids){
		authRoleService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
